// 全局样式
:root {
    --primary-color: #42b983;
    --text-color: #2c3e50;
    --background-color: #ffffff;
    --border-color: #eaecef;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
}

// 导航栏样式
nav {
    background-color: #476582;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;

    ul {
        list-style-type: none;
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        flex-wrap: wrap; // 允许导航项换行

        li {
            margin: 0.5rem 1rem; // 调整导航项间距

            a {
                color: white;
                text-decoration: none;
                transition: color 0.3s;

                &:hover {
                    color: var(--primary-color);
                }
            }
        }
    }

    .nav-toggle {
        display: none;
    }
}

// 主内容区域样式
.main-content {
    padding: 1rem; // 减少内边距
    max-width: 100%; // 让内容区域在小屏幕下占满宽度
    margin: 0 auto;
}

// 内容区域样式
#content {

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        color: #1a1a1a;
        font-weight: 600;
        line-height: 1.25;
        margin-top: 2rem;
        margin-bottom: 1rem;

        &::before {
            content: "";
            display: block;
            height: 60px;
            margin-top: -60px;
            visibility: hidden;
        }
    }

    p {
        margin-bottom: 1rem;
    }

    a {
        color: var(--primary-color);
        text-decoration: none;

        &:hover {
            text-decoration: underline;
        }
    }

    blockquote {
        margin: 1rem 0;
        padding: 0.5rem 1rem;
        border-left: 4px solid var(--primary-color);
        background-color: #f9f9f9;
    }

    code {
        background-color: rgba(27, 31, 35, 0.05);
        padding: 0.2em 0.4em;
        border-radius: 3px;
        font-size: 85%;
        word-wrap: break-word; // 允许代码换行
    }

    pre {
        background-color: #2d2d2d;
        padding: 1rem;
        border-radius: 4px;
        overflow-x: auto; // 小屏幕下允许横向滚动

        code {
            background-color: transparent;
            color: #cccccc;
            padding: 0;
            font-size: 90%;
        }
    }
}

// 移动端适配
@media (max-width: 768px) {
    nav {
        position: relative;
    }

    .nav-toggle {
        display: block;
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
    }

    nav ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #476582;
        padding: 1rem 0;
    }

    nav ul.show {
        display: flex;
        flex-direction: column;
    }
}